﻿using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using YasharEl.Infrastructure.ObjectFactory;
using YasharEl.Infrastructure.ObjectFactory.Adapters;
using YasharEl.Infrastructure.ProcessEngine.ServiceModel.Adapters.Maps;

namespace YasharEl.Infrastructure.ProcessEngine.ServiceModel.Adapters
{
    public class ProcessEngineServiceModelMapRegistrator : RegisterTypesMap
    {
        private readonly IDependencyResolver resolver;

        public ProcessEngineServiceModelMapRegistrator(IDependencyResolver resolver)
        {
            Contract.Requires<ArgumentNullException>(resolver != null, "resolver could not be null.");

            this.resolver = resolver;

            SetMaps();
        }

        #region Set Maps

        void SetMaps()
        {
            //Process Definitions
            RegisterMap<IProcessDefinition, ProcessDefinitionDTO>(new ProcessDefinitionToProcessDefinitionDTOMap());
            
            // Process Participants
            RegisterMap<IProcessParticipant, ProcessParticipantDTO>(new ProcessParticipantToProcessParticipantDTOMap());

            // Processes
            RegisterMap<IProcess, ProcessDTO>(new ProcessToProcessDTOMap(resolver));

        }

        #endregion
    }
}
